const Mock = require("mockjs");
const Random = Mock.Random;
const Dictionary = {
  status: ["未开始", "已完成", "进行中"],
  servicesItems: ["就医代办", "智能体质辨识", "视屏问诊", "挂号代办"],
  servicesPack: ["标准服务包A", "人行A会员", "标准服务包C", "标准服务包B", "Z会员"],
  companyName: ["国贸医疗大数据公司", "人行公司", "厦大小小科技", "巨大农业"],
  source: ["惠厦保", "鹭AI保"]
};

/* 记录表列表 */
const questionnaireList = function () {
  const list = [];
  for (let i = 0; i < 20; i++) {
    const obj = {
      "id": Random.id(),
      "questionnaireName": Random.ctitle(3, 8),
      "status": Random.pick(Dictionary.status),
      "handleBy": Random.cname(),
      "servicesItems": Random.pick(Dictionary.servicesItems),
      "servicesPackage": Random.pick(Dictionary.servicesPack),
      "name": Random.cname(),
      "phone": "15000000000",
      "userName": Random.first(),
      "companyName": Random.pick(Dictionary.companyName),
      "submitTime": Random.datetime("yyyy-MM-dd HH:mm:ss"),
      "source": Random.pick(Dictionary.source),
      "remark": Random.csentence(5, 10)
    };
    list.push(obj);
  }
  return {
    success: true,
    data: {
      total: 20,
      records: list
    }
  };
};
Mock.mock("/mock/getQuestionnaireList", questionnaireList);

/* 表配置列表 */
const questionnaireConfigList = function () {
  const list = [];
  for (let i = 0; i < 20; i++) {
    const obj = {
      "id": Random.id(),
      "questionnaireName": Random.ctitle(3, 8),
      "submitUser": Random.cname(),
      "description": Random.csentence(3, 10),
      "submitTime": Random.datetime("yyyy-MM-dd HH:mm:ss")
    };
    list.push(obj);
  }
  return {
    success: true,
    data: {
      total: 20,
      records: list
    }
  };
};
Mock.mock("/mock/getQuestionnaireConfigList", questionnaireConfigList);
